<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('mints', function (Blueprint $table) {
            $table->comment('出矿/转账记录');
            $table->id();
            $table->unsignedBigInteger('user_id')->comment('用户ID');
            $table->string('nft_id')->comment('nft ID');
            $table->unsignedDecimal('power', 20, 8)->comment('算力值');
            $table->unsignedDecimal('per_mint', 20, 8)->comment('单位算力产币数量');
            $table->unsignedDecimal('amount', 20, 8)->comment('出矿数量');
            $table->unsignedDecimal('fee', 20, 8)->comment('转账手续费');
            $table->unsignedDecimal('to_amount', 20, 8)->comment('实际转出数量');
            $table->string('hash')->nullable()->comment('交易哈希');
            $table->enum('status', ['waiting', 'processing', 'finished'])->default('waiting')->comment('状态 waiting等待转账 processing处理中 finished已完成');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('mints');
    }
};
